# coding: utf-8


__author__ = 'wangtao'
import getContent__computeDetailsForCandidate,getContent__computePointsForCandidate

class getContent__processCandidates:

    def __int__(self):

        _candidates = _candidatesToProcess

        _main = _candidates[0]

        _i = len(_candidates)
        for i in range(_i):
            _count__pieces = 0
            _array__pieces = []

            k = i
            _k = len(_candidates)
            for t in range(_k):
                if _candidates[k]['_count__candidates'] > 0 :
                    continue
#                if (_candidates[k]._count__candidates > 0) { continue; }
                _count__pieces += 1

            _candidates[i]['__candidate_details'] = getContent__computeDetailsForCandidate(_candidates[i], _main)

            # 设置件
            _candidates[i]['_count__pieces'] = _count__pieces
            _candidates[i]['_array__pieces'] = _array__pieces

            #件比率
            _candidates[i] = {'__candidate_details' : {'_ratio__count__pieces_to_total_pieces': _count__pieces /
                                                      (_candidates[0]['_count__pieces'] + 1) }}

#            点
            _candidates[i]['__points_history'] = getContent__computePointsForCandidate(_candidates[i], _main)
            _candidates[i]['__points'] = _candidates[i]['__points_history'][0]

            return _candidates
#_candidates.sort(function (a, b)
#    {
#    switch (true)
#    {
#    case (a.__points > b.__points): return -1;
#case (a.__points < b.__points): return 1;
#default: return 0;
#}
#});




